<template>
    <div>
      <textarea ref="editor"></textarea>
    </div>
  </template>
  
  <script>
  import 'tinymce/tinymce';
  import 'tinymce/themes/silver/theme';
  import 'tinymce/icons/default/icons';
  
  export default {
    data() {
      return {
        editor: null
      };
    },
    mounted() {
      tinymce.init({
        target: this.$refs.editor,
        plugins: 'autoresize',
        toolbar: 'undo redo | formatselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent',
        autosave_ask_before_unload: false,
        autoresize_min_height: 200,
        autoresize_max_height: 600
      });
    },
    beforeDestroy() {
      if (this.editor) {
        this.editor.destroy();
      }
    }
  };
  </script>
  